﻿/*
*************************************************************************

 Le logiciel de gestion d'EPN

 @project OpenEPN.
 @version 0.1
 @legals  (c) 2008 Damien Maillard, Sébastien Reinders. 
 Needed Components : GTK-Sharp 2.8. 
 Licensed under GPL v2.

 @author  Damien Maillard <damien.maillard@openepn.be>
 @author  Sébastien Reinders <sebastien.reinders@openepn.be>
 @since   2008.02.08
 @latest  

 This program is free software; you can 
 redistribute it and/or modify it under
 the terms of the GNU General Public License as 
 published by the Free Software
 Foundation; either version 2 of the License, or 
 (at your option) any later version.

 This program is distributed in the hope that it 
 will be useful, but WITHOUT ANY WARRANTY; without even 
 the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE. See the GNU General 
 Public License for more details.

 You should have received a copy of the GNU General 
 Public License along with this program; if not, 
 write to the Free Software Foundation, Inc., 59 Temple
 Place, Suite 330, Boston, MA 02111-1307 USA.
 
*************************************************************************
*/

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using OpenEPNClient;
using SystRestrClient;

namespace OpenEPNClient
{
    static class Program
    {
        static NotifyIcon icn;
        static ContextMenuStrip monmenu;
        
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        [STAThread]
        
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            OpenEPNClient.fen_Login formelogin = new fen_Login();
            formelogin.Show();

            icn = new NotifyIcon();         
            
            icn.Visible = true;
            icn.Icon = new System.Drawing.Icon(@"img\logo_openepn16.ico");
            affectMenu();
          
            SomeClass sc = new SomeClass();
            Application.Run();
        }

        //Fermture de session utilisateur ou administrateur
        public static void disconnectStripMenu_Click(object sender, EventArgs e)
        {
            OpenEPNClient.fen_Login formelogin = new fen_Login();
            formelogin.Show();
            //prévoir de fermer les autres fenêtres
            //prévoir de stopper des processus utilisateurs
        }

        //--------------------------------
        //---- Pour l'administrateur -----
        //--------------------------------

        //Affichage de la fenêtre des paramètres
        public static void settingsStripMenu_Click(object sender, EventArgs e)
        {
            OpenEPNClient.fen_Param formeParam = new fen_Param();
            formeParam.Show();
        }

        //Fermeture du programme
        public static void closeApplStripMenu_Click(object sender, EventArgs e)
        {
            SystRestrClient.RestrictTaslMgr.EnableCTRLALTDEL();
            RestrictKeys restrictionClavier = new RestrictKeys();
            restrictionClavier.dechargement();
            GI.BackgrndClient.Connect.deconnexion();
            GI.BackgrndClient.Login.majtextarea("Fermeture de la connexion au serveur et arrêt de l'application");
            icn.Visible = false;
            //notification de la fin de la connexion de l'utilisateur
            GI.BackgrndClient.Login.stopDecompte();
            Application.Exit();
        }

        //Fermeture de la session Windows
        public static void closeWinStripMenu_Click(object sender, EventArgs e)
        {

        }

        //Eteindre l'ordinateur
        public static void shutPcStripMenu_Click(object sender, EventArgs e)
        {

        }

        //redémarrer l'ordinateur
        public static void restartPcStripMenu_Click(object sender, EventArgs e)
        {

        }

        //--------------------------------
        //------ Pour l'utilisateur ------
        //--------------------------------

        //affichage des infos de l'utilisateur
        public static void InfoStripMenu_Click(object sender, EventArgs e)
        {
            OpenEPNClient.fen_Info formeInfo = new fen_Info();
            formeInfo.Show();
        }

        //bloque la session utilisateur
        public static void blockSessionStripMenu_Click(object sender, EventArgs e)
        {

        }

        //modification du login ou du mot de passe
        public static void changeLoginPassStripMenu_Click(object sender, EventArgs e)
        {

        }

        //ouvrir le chat
        public static void openChatStripMenu_Click(object sender, EventArgs e)
        {

        }
        

        public static void affectMenu()
        {
            monmenu = DefineContextMenu.setContextMenu();
            icn.ContextMenuStrip = monmenu;
        }
    }
}